tg-me.com/cppproglib/5784
Create:
Last Update:
Last Update:
Если необходимо быстро привести код к определённому стилю, то этом случае можно воспользоваться следующим промптом.
Rewrite the code below following the Google style guidelines for C++.
[Вставь свой код]
Было:
class userManager{
public:
int getUserCount(){return userCount;}
void setUserCount(int count){userCount=count;}
private:
int userCount;
};
void ProcessUserData(){
const int maxUsers=100;
userManager um;
for(int i=0;i<maxUsers;i++){
um.setUserCount(i);
}
}
Стало (после применения Google C++ Style Guide):
class UserManager {
public:
int GetUserCount() const { return user_count_; }
void SetUserCount(int count) { user_count_ = count; }
private:
int user_count_;
};
void ProcessUserData() {
const int MAX_USERS = 100;
UserManager user_manager;
for (int i = 0; i < MAX_USERS; ++i) {
user_manager.SetUserCount(i);
}
}
Что изменилось:
✅ Функции в
CamelCase
✅ Переменные в
snake_case
✅ Константы в
UPPER_CASE
✅ Правильные отступы и пробелы
Библиотека C/C++ разработчика #буст